import * as path from 'path'

export class PathUtil {
  // Windows路径转换
  static normalize(filepath: string): string {
    return filepath.replace(/\\/g, '/')
  }

  // 获取应用根目录
  static getRootPath(): string {
    return path.resolve(__dirname, '../..')
  }

  // 获取配置文件路径
  static getConfigPath(): string {
    return path.join(this.getRootPath(), 'config')
  }

  // 获取日志目录
  static getLogPath(): string {
    const logDir = process.env.LOG_DIR || 'C:\\logs\\live-platform'
    return this.normalize(logDir)
  }
}
